import React, {Component, Suspense} from 'react';
import {HashRouter as Router} from 'react-router-dom';
import RouterMap from './pages/router';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import store from './redux/config';
import 'hotcss';
import '&static/styles/reset.less';
import '&static/styles/styles.css';

interface IProps {

}

class App extends Component<IProps> {

    render() {
      // if ('serviceWorker' in navigator) {
      //   window.addEventListener('load', () => {
      //   navigator.serviceWorker
      //     .register('/service-worker.js')
      //     .then(registration => {
      //       console.log('service-worker registed')
      //     })
      //     .catch(error => {
      //       console.log('service-worker registed error')
      //     })
      //   })
      // }
        return (
            <Provider store={store}>
                {/* <Suspense fallback={<div>loading</div>}> */}
                    <Router>
                        <RouterMap/>
                    </Router>
                {/* </Suspense> */}
            </Provider>
        )
    }
}

render(
    <App/>,
    document.getElementById('root')
);